﻿<controls:UserControlBase x:Class="SBPweb.Communication.Client.Controls.Xmpp.Contacts.ContactsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:SBPweb.Communication.Client.Controls.Xmpp"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:utils="clr-namespace:SBPweb.Forge.Controls.Silverlight.Utilities;assembly=SBPweb.Forge.Controls.Silverlight"
    xmlns:liquid="clr-namespace:Liquid;assembly=Liquid.Menu"
    VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
    x:Name="xmppContactsView">
    <controls:UserControlBase.Resources>
        <utils:ImageSourceConverter x:Name="imageSourceConverter" />
    </controls:UserControlBase.Resources>
    <Grid>
        <ListBox Name="lbContacts" SelectionMode="Extended" Background="{Binding Background, ElementName=xmppContactsView}" SelectionChanged="ListBox_SelectionChanged" MouseLeftButtonUp="ListBox_MouseLeftButtonUp">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Height="{Binding ItemHeight, ElementName=xmppContactsView}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Border CornerRadius="8" BorderBrush="#80FFFFFF" BorderThickness="1" Margin="0,4,4,4" >
                            <Image Grid.Column="0" Source="{Binding PresenceState, Converter={StaticResource imageSourceConverter}}" />
                        </Border>
                        <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding DisplayName}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Canvas>
            <liquid:Menu x:Name="popupMenu" Visibility="Collapsed" ItemSelected="popupMenu_ItemSelected">
                <liquid:MenuItem ID="pmiStart" Text="Start...">
                    <liquid:Menu>
                        <liquid:MenuItem ID="pmiConversation" Text="Conversation" Shortcut="Ctrl+T" />
                        <liquid:MenuItem ID="pmiConference" Text="Conference" Shortcut="Ctrl+E" />
                    </liquid:Menu>
                </liquid:MenuItem>
                <liquid:MenuItem ID="pmiGet" Text="Get...">
                    <liquid:Menu>
                        <liquid:MenuItem ID="pmiProfile" Text="Profile" Shortcut="Ctrl+P" />
                    </liquid:Menu>
                </liquid:MenuItem>
            </liquid:Menu>
        </Canvas>
    </Grid>
</controls:UserControlBase>